#!/bin/sh

tabela=$1
num=$2

while read linha; do

	i=`echo $linha | cut -d' ' -f1`
	j=`echo $linha | cut -d' ' -f2`
	expected=`echo $linha | cut -d' ' -f3`
        
	echo "## when the difference is between $i and $j  ##" >> $tabela.test

	init=$((1000 - $i))
 	end=$((1000 - $j))

	echo "# edges #" >> $tabela.test
    	echo "expect $expected matchup handicapStronger=1000 handicapWeaker=$init scoreHigherRatedPlayer=$num" >> $tabela.test
	echo "expect $expected matchup handicapStronger=1000 handicapWeaker=$end scoreHigherRatedPlayer=$num" >> $tabela.test
	
	echo "" >> $tabela.test
	echo "# each value between the interval #" >> $tabela.test
	
	for cada in `seq $(($i+1)) $(($j-1))`; do
		echo "expect $expected matchup handicapStronger=1000 handicapWeaker=$((1000 - $cada)) scoreHigherRatedPlayer=$num" >> $tabela.test
	done

		
	echo "" >> $tabela.test
	echo "" >> $tabela.test
done < $tabela
